package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.model.bean.TrainingSinglePigeonResponse

/**
 * @author:hxw
 * @date  :2023/1/12
 * @desc  :
 */
class SinglePigeonTrainingAdapter(data: ArrayList<TrainingSinglePigeonResponse.SinglePigeonList>) :
    BaseQuickAdapter<TrainingSinglePigeonResponse.SinglePigeonList, BaseViewHolder>(R.layout.item_single_pingeon_training, data) {

//    @RequiresApi(Build.VERSION_CODES.M)
    override fun convert(holder: BaseViewHolder, item: TrainingSinglePigeonResponse.SinglePigeonList) {
        holder.setText(R.id.train_fly_add_check_box, item.ringId)
        if (item.startTime.isEmpty()) {
            holder.setText(R.id.train_fly_single_fly_btn, context.getString(R.string.let_fly))
            holder.setTextColor(R.id.train_fly_single_fly_btn, context.resources.getColor(R.color.white))
            holder.setBackgroundResource(R.id.train_fly_single_fly_btn, R.drawable.round_btn_blue10_b_g)
        } else {
            holder.setText(R.id.train_fly_single_fly_btn, context.getString(R.string.let_flying))
            holder.setTextColor(R.id.train_fly_single_fly_btn, context.resources.getColor(R.color.color_4CAF50))
            holder.setBackgroundColor(R.id.train_fly_single_fly_btn, context.resources.getColor(R.color.white))
        }
    }
}